package com.viphuli.app.tool.handler;

import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;

import com.viphuli.app.tool.adapter.ArrangeRecordAdapter;
import com.viphuli.app.tool.bean.page.ArrangeRecordPage;
import com.viphuli.app.tool.bean.part.ArrangeRecord;
import com.viphuli.app.tool.fragment.ArrangeRecordListFragment;
import com.viphuli.app.tool.utils.OtherUtils;

public class ArrangeRecordResponseHandler extends MyBaseHttpResponseHandler<ArrangeRecordListFragment, ArrangeRecordPage> implements
		OnItemClickListener {

	@Override
	public void deal() {

		caller.getList().addAll(page.getRecordList());

		BaseAdapter adapter = new ArrangeRecordAdapter(caller.getList());
		caller.setAdapter(adapter);
		caller.getListview().setAdapter(adapter);
		caller.getListview().setOnItemClickListener(this);
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

		ArrangeRecord record = caller.getList().get(position);

		OtherUtils.goToRecordDetails(caller.getActivity(), record);

	}

}
